const bcrypt = require('bcryptjs');

const password = process.argv[2];

if (!password) {
  console.log('Please provide a password as an argument.');
  process.exit(1);
}

bcrypt.genSalt(10, (err, salt) => {
  if (err) {
    console.error(err);
    return;
  }
  bcrypt.hash(password, salt, (err, hash) => {
    if (err) {
      console.error(err);
      return;
    }
    console.log(hash);
    process.exit(0);
  });
}); 